Skip to content

build(mac): bump webpack heap to 6 GB on the macOS appbundle build#9967

Merged
asheshv merged 1 commit into
masterfrom
fix/bundle-heap-bump
May 22, 2026
Merged

build(mac): bump webpack heap to 6 GB on the macOS appbundle build#9967
asheshv merged 1 commit into
masterfrom
fix/bundle-heap-bump

Conversation

@asheshv
Copy link
Copy Markdown
Contributor

@asheshv asheshv commented May 22, 2026

Summary

  • macOS x64 appbundle builds keep dying inside webpack's TerserPlugin at 92% (asset processing). Build #1294 on pgabf-macos-x64 reached <s> [webpack.Progress] 92% [0] sealing asset processing TerserPlugin and was killed with no V8 fatal-error preamble — pointing at the OS reaping the Node process under memory pressure rather than V8 hitting its own ceiling. (Diagnostics are visible thanks to build(mac): split bundle step and capture stderr for diagnostics #9965.)
  • TerserPlugin is already running single-threaded (parallel: false in web/webpack.config.js), so we can't claw memory back by reducing worker count. Bump V8's old-space ceiling from 3072 MB to 6144 MB inside the macOS appbundle build only.
  • The change lives entirely in pkg/mac/build-functions.sh::_complete_bundle, which already bypasses yarn run bundle and calls yarn run webpacker directly (see d96e863). So this knob is independent of the npm script and does not affect linux/pip/Makefile or dev-machine builds — they keep the 3 GB that the bundle npm script has been shipping with for years.

Test plan

  • Re-trigger pgadmin4-macos-qa on both macos-x64 and macos-arm64 and confirm the appbundle now builds successfully end-to-end.
  • In the x64 Jenkins console, verify webpack progresses past 92% [0] sealing asset processing TerserPlugin and reaches emitting/done without truncation.
  • Spot-check the produced .dmg size on x64 vs arm64 to confirm both bundles are intact.

If this doesn't work

The next step would be switching the minimiser from Terser to esbuild via terser-webpack-plugin's minify option (much lower memory). That's a larger, more invasive change, so this cheap fix goes first.

Summary by CodeRabbit

  • Chores
    • Increased memory allocation for macOS builds to enhance build performance and stability.

Review Change Stack

macOS x64 appbundle builds keep dying inside webpack's TerserPlugin at
92% (asset processing). Build #1294 on `pgabf-macos-x64` reached
`<s> [webpack.Progress] 92% [0] sealing asset processing TerserPlugin`
and was killed without producing a V8 fatal-error preamble, which
points at the OS reaping the Node process under memory pressure rather
than V8 hitting its own heap ceiling.

TerserPlugin is already running single-threaded (see
web/webpack.config.js, `parallel: false`), so we can't claw memory back
by reducing parallelism. Bump the V8 old-space ceiling from 3072 MB to
6144 MB inside the macOS appbundle build only — the helper in
pkg/mac/build-functions.sh bypasses `yarn run bundle` and calls
`yarn run webpacker` directly (see commit d96e863), so this knob is
independent of the npm script and does not affect linux/pip/Makefile
or dev-machine builds. They keep the 3 GB the `bundle` script has been
shipping with for years.

If this still doesn't get the x64 box past Terser we'll switch the
minimiser to esbuild via terser-webpack-plugin's `minify` option; that
is a larger and more invasive change so we are trying the cheap fix
first.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1ebc6819-40a8-4bfc-a41c-d95b8f727ca1

📥 Commits

Reviewing files that changed from the base of the PR and between d96e863 and 0145343.

📒 Files selected for processing (1)
  • pkg/mac/build-functions.sh

Walkthrough

The PR updates the macOS build script to increase the V8 engine's old-space memory limit during webpack bundling from 3072 MB to 6144 MB, adjusting the corresponding documentation comments to reflect this larger memory allocation.

Changes

Memory Configuration Update

Layer / File(s) Summary
Node memory configuration
pkg/mac/build-functions.sh
NODE_OPTIONS environment variable increases V8's --max-old-space-size from 3072 to 6144 MB during the build phase, with related comments updated to reflect the higher memory limit.

Possibly related PRs

  • pgadmin-org/pgadmin4#9965: Both PRs modify pkg/mac/build-functions.sh to adjust NODE_OPTIONS memory limit for the macOS x64 build, with this PR raising the limit to 6144 MB as a follow-up to the earlier change.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: increasing Node's heap memory limit from 3GB to 6GB for the macOS appbundle webpack build.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bundle-heap-bump

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@asheshv asheshv merged commit 3e1921d into master May 22, 2026
50 checks passed
asheshv added a commit that referenced this pull request May 22, 2026
…9968)

The 6 GB ceiling set by #9967 was too aggressive for the macOS x64
VM's total RAM. Build #1295 on `pgabf-macos-x64` failed in
`_build_runtime` at `unzip electron-vX.X.X-darwin-x64.zip` with exit
code 2 — never even reached webpack. That points at OS-level memory
pressure spilling out of the Node process and starving the rest of
the build: at 6 GB reserved, the box runs out of RAM long before
Terser actually needs the full ceiling.

Drop back to 4 GB, which still gives Terser a full extra gigabyte
beyond the original 3 GB setting that OOM-killed webpack in #1294,
but leaves enough headroom for the other steps in the appbundle
build to coexist.

Only the macOS appbundle path changes (see pkg/mac/build-functions.sh);
linux/pip/Makefile and dev-machine builds keep the 3 GB the `bundle`
npm script ships with.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant